import { post } from '@/core/utils/http';
import type { Response, GoodsListType, CategoriesType, GoodsPictureType, GoodsParamsType, ServiceGoodsType } from '@/core/models';

/**  获取商品分类配置 */
export const queryAllCategories = () : Promise<Response<Array<CategoriesType>>> => {
	return post('Api/Good/GetAllCategories');
}

/**  获取商品列表数据 */
export const queryGoodsPageList = (data : any) : Promise<Response<GoodsListType>> => {
	return post('Api/Good/GetGoodsPageList', {
		data,
	});
}

/**  普通获取商品详情 */
export const queryGoodsDetail = (data : any) : Promise<Response<any>> => {
	return post('Api/Good/GetDetial', {
		data,
	});
}

/**  获取为您推荐商品 */
export const queryGoodsRecommendList = (data : any) : Promise<Response<any>> => {
	return post('Api/Good/GetGoodsRecommendList', {
		data,
	});
}

/**  带token获取商品详情 */
export const queryGoodsDetailByToken = (data : any) : Promise<Response<any>> => {
	return post('Api/Good/GetDetialByToken', {
		data,
	}, true);
}

/**  商品关键词说明，例如常见问题等 */
export const queryServiceDescriptionl = () : Promise<Response<any>> => {
	return post('Api/Common/GetServiceDescription');
}

/**  获取商品评价 */
export const queryGoodsComment = (data : any) : Promise<Response<GoodsPictureType>> => {
	return post('Api/Good/GetGoodsComment', {
		data,
	});
}

/**  获取商品参数 */
export const queryGoodsParams = (data : any) : Promise<Response<Array<GoodsParamsType>>> => {
	return post('Api/Good/GetGoodsParams', {
		data,
	});
}

/**  获取商品促销列表 */
export const queryPromotionList = (data : any) : Promise<Response<Array<any>>> => {
	return post('Api/Promotion/GetPromotionList', {
		data,
	});
}

/** 获取服务商品列表 */
export const queryServicelist = (data : any) : Promise<Response<{count:number,list:Array<ServiceGoodsType>}>> => {
	return post('Api/Service/GetPageList', {
		data,
	});
}

/** 添加商品浏览足迹 */
export const queryAddGoodsBrowsing = (data : any) : Promise<Response<any>> => {
	return post('Api/User/AddGoodsBrowsing', {
		data,
	}, true);
}